/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rules.generator;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.logging.Level;
import java.util.logging.Logger;
import matching.xml.MatchingManager;
import org.jdom.JDOMException;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.semanticweb.owl.model.OWLOntologyCreationException;

/**
 *
 * @author arida
 */
public class Teste {
    public static  void  main(String args[]) throws JDOMException, IOException{
        MatchingManager mm = MatchingManager.getInstance();
        try {
            try {
                mm.loadFile(new File("C:/Users/arida/Documents/NetBeansProjects/trunk/MappingTool/test/xml/exMatching.xml"));
                Generator g = new Generator(mm.matching);
                g.generateRules();
                File f = new File("C:/Users/arida/Documents/NetBeansProjects/trunk/MappingTool/test/xml/testeRules2.xml");
                FileWriter arquivo = new FileWriter(f);
                Format fmt = Format.getPrettyFormat();
                fmt.setIndent( "    " );
                XMLOutputter xout = new XMLOutputter(fmt);
                xout.output(g.sm.getDoc() , arquivo);
            arquivo.close();
            } catch (URISyntaxException ex) {
                Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
            } catch (OWLOntologyCreationException ex) {
                Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
            }         
            
        }
        catch( IOException e )
        {
            // TODO Auto-generated catch block
            System.out.println(e.getMessage());
            e.printStackTrace();
        }
    }
}
